import axios from '@/api/fetch';
//import * as types from './types';
import SERVER from '@/api/server';
//维修项目新增列表
export const getLabourList = params =>
  axios.get(`${SERVER.CLAIMFAC}/const/getLabourList`, {
    params
  });
//配件换上件新增列表
export const getShangJianListByPage = params => axios.post(`${SERVER.CLAIMFAC}/rpPart/getListByPage`, params);
//配件换下件新增列表
export const getXiaJianListByPage = params => axios.post(`${SERVER.CLAIMFAC}/rpPart/getListByPage`, params);
//附加项目新增列表
export const getFuJiaXiangMuListByPage = (params) => axios.get(`${SERVER.CLAIMFAC}/const/getAddList`, { params });
//维修工单号列表
export const getWeiXiuGongDanListByPage = (params) => axios.get(`${SERVER.CLAIMFAC}/const/getRoList`, { params });
//主损件选择
export const zhuSunJianSelect = (params) => axios.get(`${SERVER.CLAIMFAC}/const/getPartList`, { params });
//故障现象列表
export const getGuZhangXianXiangListByPage = params => axios.post(`${SERVER.CLAIMFAC}/rPFaultAppear/getListByPage`, params);
//故障原因列表
export const getGuZhangYuanYinListByPage = params => axios.post(`${SERVER.CLAIMFAC}/rPFaultReason/getListByPage`, params);
//自费工单选择
export const getZiFeiGongDanListByPage = (params) => axios.get(`${SERVER.CLAIMFAC}/const/getSelfList`, { params });

//预授权状态下拉
export const getPartType = (params) => axios.get(`${SERVER.CLAIMFAC}/const/getBaseDataByType`, { params });
//预授权新增
//新增的保存
export const newSave = params => axios.post(`${SERVER.CLAIMFAC}/rPPreAuth/saveOne`, params);
//编辑的保存
export const editSave = params => axios.post(`${SERVER.CLAIMFAC}/rPPreAuth/updateByPtId`,  params );
//预授权检索
export const getListByPage = params => axios.post(`${SERVER.CLAIMFAC}/rPPreAuth/getListByPage`, params);

//车型取得
export const getModelList = params =>
  axios.get(`${SERVER.CLAIMFAC}/const/getModelList`, {
    params
  });
//修改回显
export const quyRpPreAuth = (id, params) => axios.get(`${SERVER.CLAIMFAC}/rPPreAuth/selectById/${id}`, { params });

//修改回显 按authNo查询 索赔查看调用
export const selectByNo = (id, params) => axios.get(`${SERVER.CLAIMFAC}/rPPreAuth/selectByNo/${id}`, { params });


//索赔类型取得
export const cmsClaimTypeStr = params =>
  axios.get(`${SERVER.CLAIMFAC}/const/getBaseDataByType`, {
    params
  });
//供应商下拉框
export const getSupplierList = params => axios.get(`${SERVER.CLAIMFAC}/const/getSupplierList`, { params });
//索赔类型取得
export const getclaimType = (params) => axios.get(`${SERVER.CLAIMFAC}/const/getBaseDataByType`, { params });
//救援单取得
export const getjiuYuanList = (params) => axios.get(`${SERVER.CLAIMFAC}/const/getHelpList`, { params });
//作废（单条删除）
export const backAduit = params => axios.post(`${SERVER.CLAIMFAC}/rPPreAuth/updateStatusByAuthId`,params);
//审核记录
export const getAuditRecord = params => axios.post(`${SERVER.CLAIMFAC}/rPPreAuthLog/getListByPage`, params);
//维修历史
export const getMaintenanceHistory = params => axios.get(`${SERVER.CLAIMFAC}/const/getRoLogList`,  { params });
//变更记录
export const getChangeRecord = params => axios.post(`${SERVER.CLAIMFAC}/rPPreAuthChange/getListByPage`, params);
//索赔历史
export const getClaimHistory = params => axios.post(`${SERVER.CLAIMFAC}/rPCmsClaim/getListByPage`, params);
//获取工单部分信息（通过工单号取外部接口数据）
export const quyRomessage = params => axios.get(`${SERVER.CLAIMFAC}/const/getRoById`,    { params } );
//导出
export const getListForExport = (params) => axios.post(`${SERVER.CLAIMFAC}/rPPreAuth/getListForExport`, params, {
  responseType: 'blob'
});
//下载中心导出
export const exporturl = params => axios.post(`/api/cmscloud.excel/downloadExcel/exportExcel/${params.CODE}`, params);
//获取经销商
export const getDealerList = params =>
  axios.get(`${SERVER.CLAIMFAC}/const/getDealerList`, {
    params
  });

//导出模版
export const downloadModel = params => {
  const url = `${SERVER.CLAIMFAC}/rPPreAuth/exportModel`;
  return axios({
    url,
    method: 'post',
    responseType: 'blob'
  });
};
// 导入
export const importExcel = (params) => axios.post(`${SERVER.CLAIMFAC}/rPPreAuth/importExcel`, params, {
  responseType: 'blob'
});
